package mutsumimod.cards.custom;

import com.evacipated.cardcrawl.mod.stslib.fields.cards.AbstractCard.FleetingField;
import com.megacrit.cardcrawl.actions.animations.VFXAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.vfx.FastCardObtainEffect;
import com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect;
import mutsumimod.cards.BaseCard;
import mutsumimod.cards.derivative.DontRuinIt;
import mutsumimod.character.Mutsumi;
import mutsumimod.util.CardStats;
import mutsumimod.util.tags.CustomTags;
import mutsumimod.vfx.FleetingEffect;

public class Weltanschauung extends BaseCard {
    public static final String ID = makeID(Weltanschauung.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.UNCOMMON,
            CardTarget.SELF,
            0
    );

    public Weltanschauung() {
        super(ID, info);
        FleetingField.fleeting.set(this, true);
        this.cardsToPreview = new DontRuinIt();
        tags.add(CardTags.HEALING);
        tags.add(CustomTags.SELF_CARD);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        AbstractDungeon.player.masterDeck.group.stream()
                .filter(c -> c.uuid.equals(uuid))
                .forEach(c -> addToBot(new VFXAction(new FleetingEffect(c))));
        addToBot(new VFXAction(new ShowCardAndObtainEffect(new DontRuinIt(p.currentHealth,p.maxHealth), (float) Settings.WIDTH / 2, (float) Settings.HEIGHT / 2)));
    }

    @Override
    public AbstractCard makeCopy() {
        return new Weltanschauung();
    }

    @Override
    public void upgrade() {
        if (this.upgraded) {
            return;
        }
        upgradeName();
        this.selfRetain = true;
        this.rawDescription = cardStrings.UPGRADE_DESCRIPTION;
        this.initializeDescription();
    }
}
